package com.emin.platform.subjectcenter.vo;

import com.emin.platform.subjectcenter.entity.Ecm;
import com.emin.platform.subjectcenter.entity.Industory;
import lombok.Data;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.BeansException;

import java.util.ArrayList;
import java.util.List;

/**
 * 主体返回Vo类
 *
 * @author Jack
 * @version V1.0
 * @Title:
 * @Description: 主体返回Vo类
 * @date 2017/10/25 11:43
 */
@Data
public class EcmResponseVo extends BaseVo {

    private static Logger LOGGER = LoggerFactory.getLogger(EcmResponseVo.class);

    /*主体名称*/
    private String name;
    /*主体编号*/
    private String sn;
    /*主体地址*/
    private String address;
    /*主体描述*/
    private String describe;
    /*主体行业*/
    private List<IndustoryResponseVo> industories = new ArrayList<>();
    /*激活还是禁用状态*/
    private int activeStatus;


    /**
     * @param ecm
     * @return
     */
    public EcmResponseVo convert(Ecm ecm) {
        try {
            BeanUtils.copyProperties(ecm, this);
            return this;
        } catch (BeansException e) {
            LOGGER.error("Ecm转换成EcmResponseVo异常");
            return null;
        }
    }


}
